package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerBankItemQueryResponse extends BaseQLResponse
{
    /// <summary>
    /// 物品列表
    /// </summary>
    public List<ButlerItemInfo> Items;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_bank_item_query_response");
            Items = new ArrayList<ButlerItemInfo>();
            JSONArray arrItems = t.getJSONObject("items").getJSONArray("butler_item_info");
            for (int i = 0; i < arrItems.size(); ++i)
            {
                ButlerItemInfo o = new ButlerItemInfo();
                o.DeserializeFromJson(arrItems.getJSONObject(i));
                Items.add(o);
            }
        }
    }
}
